package com.phc.a20200511work.paopao;

import android.os.Bundle;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.phc.a20200511work.R;

import java.util.List;

public class paopaoGoods extends AppCompatActivity {
    private static final String TAG = "paopaoGoods";
    private RecyclerView activityPaopaoGoodsRecycler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_paopao_goods);
        int type = getIntent().getIntExtra("type", -1);
        if (type == -1) {
            Toast.makeText(this, "出现了意料之外的bug", Toast.LENGTH_SHORT).show();
        }
        initView();
        //拿到参数
        List<List<InfoBean>> allList = pappaoData.getAllList();
        List<InfoBean> infoBeans = allList.get(type);
//        for (int i = 0; i < infoBeans.size(); i++) {
//            infoBeans.get(i).getPic();
//            infoBeans.get(i).getTitle();
//            infoBeans.get(i).getKind();
//            infoBeans.get(i).getCount();
//            infoBeans.get(i).getPrice();
//        }
        //调用适配器
        paopaoAdapter paopaoAdapter = new paopaoAdapter(infoBeans,this);
        activityPaopaoGoodsRecycler.setLayoutManager(new LinearLayoutManager(this));
        activityPaopaoGoodsRecycler.setAdapter(paopaoAdapter);
    }

    private void initView() {
        activityPaopaoGoodsRecycler = (RecyclerView) findViewById(R.id.activity_paopao_goods_recycler);
    }
}
